package com.example.day41_opengl_camera1;

import android.opengl.GLES20;
import android.opengl.GLSurfaceView;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

/**
 * Description:
 * Created by Gdu on 2021/4/24 19:17.
 */

public class BackgroundRender implements GLSurfaceView.Renderer {
    @Override
    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
        //初始化
        //第一步 清除之前残留的数据  清成黑色
        GLES20.glClearColor(0.0f,0.0f,0.0f,1.0f);
    }
    /*
    opengl的api都是静态api
     */

    @Override
    public void onSurfaceChanged(GL10 gl, int width, int height) {
        //告诉GPU大小改变
        GLES20.glViewport(0,0,width,height);
    }

    //真正渲染的方法   类似view.onDraw
    //opengl 2种方式  一种16ms  一种手动刷新
    @Override
    public void onDrawFrame(GL10 gl) {
        GLES20.glClearColor(0.0f,0.0f,0.0f,1.0f);
    }
}
